//                 _              
//                | |             
//   __ _ _ __ ___| |__ __  _____ 
//  / _` | '__/ __| '_ \\ \/ / __|
// | (_| | | | (__| | | |>  <\__ \
//  \__,_|_|  \___|_| |_/_/\_\___/
//                                
// Copyright 2010 Scott Dixon http://www.archxs.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package com.archxs.commons;

import org.junit.Assert;
import org.junit.Test;

import com.archxs.commons.Variant;

/**
 * Unit tests covering boolean conversions using {@link Variant}
 */
public class VariantBooleanTest {

    @Test
    public void testBoolean() {
        Assert.assertTrue(Variant.valueOf(Boolean.toString(true)).booleanValue());
        Assert.assertTrue(Variant.valueOf("true").booleanValue());
        Assert.assertTrue(Variant.valueOf("tRue").booleanValue());
        Assert.assertTrue(Variant.valueOf("1").booleanValue());
        Assert.assertFalse(Variant.valueOf(Boolean.toString(false)).booleanValue());
        Assert.assertFalse(Variant.valueOf("false").booleanValue());
        Assert.assertFalse(Variant.valueOf("falSe").booleanValue());
        Assert.assertFalse(Variant.valueOf("some other word(s)").booleanValue());
        Assert.assertFalse(Variant.valueOf("0").booleanValue());
        Assert.assertFalse(Variant.valueOf("-1").booleanValue());
    }
}
